#include "my_malloc.h"

int main() {
	void* ptr_0;
	void* ptr_1;
	void* ptr_2;
	void* ptr_3;
	void* ptr_4;
	void* ptr_5;
	void* ptr_6;
	void* ptr_7;
	void* ptr_8;
	
	printf("\n=====TEST CASE 0: malloc(18)=====\n");	
	ptr_0 = my_malloc(18);
	printf("\tptr->%lo\n",(unsigned long)ptr_0);
	my_free(ptr_0);
	printf(" Freed: malloc(18) -> ptr=%lo\n",(unsigned long)ptr_0);

	printf("\n=====TEST CASE 1: malloc(440)=====\n");	
	ptr_1 = my_malloc(440);
	printf("\tptr->%lo\n",(unsigned long)ptr_1);
	my_free(ptr_1);
	printf(" Freed: malloc(440) -> ptr=%lo\n",(unsigned long)ptr_1);

	printf("\n=====TEST CASE 2: malloc(100)=====\n");	
	ptr_2 = my_malloc(100);
	printf("\tptr->%lo\n",(unsigned long)ptr_2);
	my_free(ptr_2);
	printf(" Freed: malloc(100) -> ptr=%lo\n",(unsigned long)ptr_2);

	printf("\n=====TEST CASE 3: malloc(500)=====\n");		
	ptr_3 = my_malloc(500);
	printf("\tptr->%lo\n",(unsigned long)ptr_3);
	my_free(ptr_3);
	printf(" Freed: malloc(500) -> ptr=%lo\n",(unsigned long)ptr_3);

	printf("\n=====TEST CASE 4: malloc(2036)=====\n");		
	ptr_4 = my_malloc(2036);
	printf("\tptr->%lo\n",(unsigned long)ptr_4);
	my_free(ptr_4);
	printf(" Freed: malloc(2036) -> ptr=%lo\n",(unsigned long)ptr_4);

	printf("\n=====TEST CASE 5: malloc(1000) x 4=====\n");		
	ptr_5 = my_malloc(1000);
	printf("\t1 ptr->%lo\n",(unsigned long)ptr_5);
	ptr_6 = my_malloc(1000);
	printf("\t2 ptr->%lo\n",(unsigned long)ptr_6);
	ptr_7 = my_malloc(1000);
	printf("\t3 ptr->%lo\n",(unsigned long)ptr_7);
	ptr_8 = my_malloc(1000);
	printf("\t4 ptr->%lo\n",(unsigned long)ptr_8);

	printf("\n======TEST CASE 6: free(malloc(1000)) x 4======\n");
	my_free(ptr_5);
	printf(" Freed: 1 malloc(1000) -> ptr=%lo\n",(unsigned long)ptr_5);
	my_free(ptr_6);
	printf(" Freed: 2 malloc(1000) -> ptr=%lo\n",(unsigned long)ptr_6);
	my_free(ptr_7);
	printf(" Freed: 3 malloc(1000) -> ptr=%lo\n",(unsigned long)ptr_7);
	my_free(ptr_8);
	printf(" Freed: 4 malloc(1000) -> ptr=%lo\n",(unsigned long)ptr_8);
	return 0;

}
